package cn.wolf.other;


/**
 * 单例模式-懒汉式
 */
public class LazySingleton {
    //volatile 保证变量可见性
    private static volatile LazySingleton instance = null;

    private LazySingleton(){};

    public static synchronized LazySingleton getInstance(){
        if(instance == null){
            instance = new LazySingleton();
        }
        return instance;
    }
}
